package com.judysen.jsqlweb.models;

import lombok.Data;

import java.util.List;
import java.util.Map;

@Data
public class Pager {
    private String table;
    private Integer pageIndex = 0;
    private Integer pageSize = 15;
    private Map<String, Object> filter;
    private List<Map<String,Object>> records;
    private Integer totalCount;

    /**
     * 返回查询的开始index
     *
     * @return
     */
    public Integer getStartIndex() {
        var startIndex = pageIndex * pageSize - 1;
        return startIndex > 0 ? startIndex : 0;
    }
}
